function e(e, t) {
    if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
}

Object.defineProperty(exports, "__esModule", {
    value: !0
});

var t = function() {
    function e(e, t) {
        for (var s = 0; s < t.length; s++) {
            var n = t[s];
            n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), 
            Object.defineProperty(e, n.key, n);
        }
    }
    return function(t, s, n) {
        return s && e(t.prototype, s), n && e(t, n), t;
    };
}(), s = function() {
    function s(t, n) {
        e(this, s), this.success = this.funcSuccess.bind(this), this.fail = this.funcFail.bind(this), 
        this._wxResult = {}, this._callback = n ? t.bind(n) : t, this._issuccess = !1;
        var i = Math.random();
        this.setKey(i), wxapp.evtCenter.listen(this._eventKey, this._callback, this);
    }
    return t(s, [ {
        key: "setKey",
        value: function(e) {
            this._eventKey = wxapp.evts.EVT_OBJECT_RESULT + e;
        }
    }, {
        key: "release",
        value: function() {
            wxapp.evtCenter.ignore(this._eventKey, this._callback, this);
        }
    }, {
        key: "getFunc",
        value: function(e) {
            return this[e].bind(this);
        }
    }, {
        key: "funcSuccess",
        value: function(e) {
            e && (this._wxResult = e), this._issuccess = !0, wxapp.evtCenter.trigger(this._eventKey, this);
        }
    }, {
        key: "funcFail",
        value: function(e) {
            e && (this._wxResult = e), this._issuccess = !1, wxapp.evtCenter.trigger(this._eventKey, this);
        }
    }, {
        key: "funcComplete",
        value: function(e) {
            console.log("complete " + JSON.stringify(e));
        }
    }, {
        key: "isSuccess",
        value: function() {
            return this._issuccess;
        }
    }, {
        key: "getResult",
        value: function() {
            return this._wxResult;
        }
    } ]), s;
}();

exports.default = s;